package com.foxchen.ddns.service.impl.v4;

import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.foxchen.ddns.service.IpGetServiceV4;
import org.springframework.stereotype.Component;

@Component("https://qifu-api.baidubce.com/ip/local/geo/v1/district")
public class BaiduBceServiceImpl implements IpGetServiceV4 {
    @Override
    public String getIp(String url) {
        String searchIpRes = HttpUtil.get(url,3000);
        JSONObject jsonObject = JSON.parseObject(searchIpRes);
        return (String) jsonObject.get("ip");
    }
}
